package com.skiving.cloud.auth.util;

import cn.dev33.satoken.stp.StpUtil;
import com.skiving.cloud.auth.constant.AuthConstant;
import com.skiving.cloud.auth.entity.AuthUser;

/**
 * 当前回话的用户
 */
public class UserUtil {
    public static AuthUser getCurrentUser(){
        try {
            return (AuthUser) StpUtil.getSession().get(AuthConstant.USER_SESSION);
        } catch (Exception e) {
            return new AuthUser();
        }
    }
}
